//
//  CollFirstFindRect.m
//  练习11
//
//  Created by 张琦 on 15/11/21.
//  Copyright © 2015年 张琦. All rights reserved.
//

#import "CollFirstFindRect.h"
#import "UIImageView+WebCache.h"
@interface CollFirstFindRect ()
@property (nonatomic, retain) UIImageView *imageTitle;
@property (nonatomic, retain) UILabel *labelTitle;
@end
@implementation CollFirstFindRect





- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self createView];
    }
    return self;
}


- (void)createView
{
    self.imageTitle = [[UIImageView alloc] init];
    self.imageTitle.backgroundColor = [UIColor cyanColor];
    [self.contentView addSubview:self.imageTitle];
    
    self.labelTitle = [[UILabel alloc] init];
    self.labelTitle.backgroundColor = [UIColor cyanColor];
    [self.contentView addSubview:self.labelTitle];
}

- (void)setDic:(NSDictionary *)dic
{
    if (_dic != dic) {
        [_dic release];
        _dic = [dic retain];
    }
    self.labelTitle.text = [dic objectForKey:@"name"];
    [self.imageTitle sd_setImageWithURL:[NSURL URLWithString:[dic objectForKey:@"picUrl"]]];
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    
}

- (void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes
{
    [super applyLayoutAttributes:layoutAttributes];
    self.imageTitle.frame = CGRectMake(0, 0, 100, 100);
    self.labelTitle.frame = CGRectMake(0, 100, 100, 30);
}

@end








